#ifndef CITEM_H_INCLUDED
#define CITEM_H_INCLUDED

#include <map>
#include <string>

#include <libtcod/libtcod.hpp>

#include "CGameObject.h"

typedef enum
{
	EES_NONE, // for holdable items only
	EES_HEAD, // hats, helmets, etc
	EES_NECK, // necklaces, amulets, etc
	EES_BACK, // capes, cloaks, etc
	EES_BODY, // breastplates, (chain) shirts, etc
	EES_HANDS, // gloves, gauntlets, etc
	EES_WIELD, // wielded items
	EES_SHIELD, // shields
	EES_RING1, // rings
	EES_RING2, // rings
	EES_LEGS, // leggings, greaves, pants, etc
	EES_FEET, // boots, shoes, etc
	EES_NUM_SLOTS
} EEquipSlot;

struct SBaseItem
{
    EEquipSlot EquipSlot;
    float Weight;
    std::string Type;
    TCOD_dice_t Damage;
    TCODList<const char*> DamageTypes;
};

struct SMaterial
{
    float DamageModifier;
    float WeightModifier;
};

class CItem : public CGameObject
{
public:
    virtual bool isEquipped();
	virtual bool isHeld();

	virtual EEquipSlot getEquipSlot();

	virtual float getWeight();

	static std::map<std::string, SBaseItem> Items;
	static std::map<std::string, SMaterial> Materials;

	static std::string getEquipSlotName(EEquipSlot slot);
	static std::string getRandomItem();
	static std::string getRandomMaterial();

    virtual std::string getBaseName();
	virtual std::string getMaterial();
	virtual std::string getQuality();
	virtual std::string getName();

	virtual void createOnGround(std::string name, char shape, pair position);
	virtual void setEquipped(bool equipped);
	virtual void setHeld(bool held);

	static void loadBaseItems();
	static void loadMaterials();

protected:
    bool Equipped;
	bool Held;

	std::string Material;
	std::string Quality;
};

#endif
